package sort;


public class Insertion implements Sortable{


    @Override
    public void sort(int[] arr) {
        for (int i=1; i<arr.length; i++) {

            for (int j=0; j<i; j++) {
                if (arr[i] < arr[j]) {
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }

        }
    }


    public static void main(String[] args) {
        System.out.println("before sort ");
        ArrayData.printArr();
        new Insertion().sort(ArrayData.ARR);
        System.out.println("after sort ");
        ArrayData.printArr();
    }

}
